package com.tiniplanet.webgate.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "WEB_CREDENTIAL")
public class Credential extends AbstractModel {

	private static final long serialVersionUID = 3266165296050231861L;

	private String username;
	private String password;
	private Role role;

	/**
	 * @return the username
	 */
	@Id
	@Column(name = "EMPLOYEE_NO", nullable = false, length = 10)
	public String getUsername() {
		return username;
	}

	/**
	 * @param username
	 *            the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return the password
	 */
	@Column(name = "EMPLOYEE_PASSWORD", nullable = true, length = 32)
	public String getPassword() {
		return password;
	}

	/**
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the role
	 */
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ROLE_NO", nullable = true)
	public Role getRole() {
		return role;
	}

	/**
	 * @param role
	 *            the role to set
	 */
	public void setRole(Role role) {
		this.role = role;
	}

}
